package com.Stream;

import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;

public class StreamDemo06 {
    public static void main(String[] args) {
        ArrayList<Integer> list1=new ArrayList<>();
        for (int i = 1; i <=10; i++) {
            list1.add(i);
        }
        list1.add(10);
        list1.add(10);
        list1.add(10);
        List<Integer> collect = list1.stream().filter(number -> number % 2 == 0).collect(Collectors.toList());
        System.out.println(collect);
        Set<Integer> collect1 = list1.stream().filter(number -> number % 2 == 0).collect(Collectors.toSet());
        System.out.println(collect1);
    }
}
